#include<bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long qmi(long long a,int b)
{
	long long res = 1;
	while(b)
	{
		if(b & 1) (res *= a) %= mod;
		(a *= a) %= mod;
		b >>= 1;
	}
	return res;
}
long long f[1000003][5];
int a[1000003];
int n,k;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	freopen("game.in","r",stdin);
	freopen("game.out","w",stdout);
	cin >> n >> k;
	for(int i = 1;i <= n;i++)
		cin >> a[i];
	for(int i = 1;i <= min(n - k,3);i++)
		f[n - k][i] = 1;
	for(int i = n - k + 1;i <= n;i++)
		for(int j = 1;j <= min(3,i);j++)
			f[i][j] = ((j + mod - 3) * f[i - 1][j - 1] + (i - j) * f[i - 1][j]) % mod;
	long long ans = 0;
	for(int i = 1;i <= n;i++)
		ans += a[i] * f[n][min(i,3)] % mod;
	long long fac = 1;
	for(int i = n - 1;i >= n - k;i--)
		fac = fac * i % mod;
	cout << ans % mod * qmi(fac,mod - 2) % mod;
	return 0;
}